﻿Public Class FrmMain
    Public Property FileName() As String
        Get
            Return _FileName
        End Get
        Set(ByVal value As String)
            _FileName = value
        End Set
    End Property
    Private _FileName As String

    '~~ File Menu
    Private Sub MnuFileNew_Click(ByVal sender As System.Object, _
                                 ByVal e As System.EventArgs) _
                                 Handles MnuFileNew.Click, TBBtnNew.Click
        'If CtrlEditor.Modified = True And My.Settings.SaveBeforeClose = True Then
        'If MsgBox("Save before closing?", _
        'MsgBoxStyle.YesNoCancel Or MsgBoxStyle.Question) = _
        'MsgBoxResult.AbortMsgBoxResult.Yes Then _
        'Then
        'MnuFileSave_Click(sender, e)
        'End If
        'End If
        CtrlEditor.Clear()
        CtrlEditor.ClearUndo()
        CtrlEditor.Modified = False
    End Sub

    Private Sub MnuFileOpen_Click(ByVal sender As System.Object, _
                              ByVal e As System.EventArgs) _
                              Handles MnuFileOpen.Click
        'TODO: open file
    End Sub

    Private Sub MnuFileSave_Click(ByVal sender As System.Object, _
                          ByVal e As System.EventArgs) _
                          Handles MnuFileSave.Click
        'TODO: save file
    End Sub

    Private Sub mnuFileExit_Click(ByVal sender As System.Object, _
                                  ByVal e As System.EventArgs) _
                                  Handles MnuFileExit.Click
        Me.Close()
    End Sub

    '~~ Edit Menu
    Private Sub mnuEditUndo_Click(ByVal sender As System.Object, _
                              ByVal e As System.EventArgs) _
                              Handles MnuEditUndo.Click, TBBtnUndo.Click
        CtrlEditor.Undo()
    End Sub

    Private Sub mnuEditCut_Click(ByVal sender As System.Object, _
                                 ByVal e As System.EventArgs) _
                                 Handles MnuEditCut.Click, TBBtnCut.Click
        CtrlEditor.Cut()
    End Sub

    Private Sub mnuEditCopy_Click(ByVal sender As System.Object, _
                                  ByVal e As System.EventArgs) _
                                  Handles MnuEditCopy.Click, TBBtnCopy.Click
        CtrlEditor.Copy()
    End Sub

    Private Sub mnuEditPaste_Click(ByVal sender As System.Object, _
                                   ByVal e As System.EventArgs) _
                                   Handles MnuEditPaste.Click, _
                                    TBBtnPaste.Click
        CtrlEditor.Paste()
    End Sub

    Private Sub mnuEditSelectAll_Click(ByVal sender As System.Object, _
                                       ByVal e As System.EventArgs) _
                                       Handles MnuEditSelectAll.Click
        CtrlEditor.SelectAll()
    End Sub

    Private Sub mnuEditClear_Click(ByVal sender As System.Object, _
                                   ByVal e As System.EventArgs) _
                                   Handles MnuEditClear.Click
        CtrlEditor.SelectedText = ""
    End Sub

    Private Sub mnuEditFind_Click(ByVal sender As System.Object, _
                                  ByVal e As System.EventArgs) _
                                  Handles MnuEditFind.Click, TBBtnFind.Click

    End Sub

    '~~ View Menu
    Private Sub mnuViewStatusbar_Click(ByVal sender As System.Object, _
                                       ByVal e As System.EventArgs) _
                                       Handles MnuViewStatusbar.Click
        CtrlStatusbar.Visible = MnuViewStatusbar.Checked
    End Sub

    Private Sub mnuViewToolbar_Click(ByVal sender As System.Object, _
                                     ByVal e As System.EventArgs) _
                                     Handles MnuViewToolbar.Click
        CtrlToolbar.Visible = MnuViewToolbar.Checked
    End Sub

    Private Sub mnuViewWordWrap_Click(ByVal sender As System.Object, _
                                      ByVal e As System.EventArgs) _
                                      Handles MnuViewWordWrap.Click
        CtrlEditor.WordWrap = MnuViewWordWrap.Checked
    End Sub
End Class
